import request from '../utils/request';

// 获取订单列表
export const getOrderService = (OrdersPageQueryReqDTO) => {
    console.log(OrdersPageQueryReqDTO)
    return request.get('/Treasure-Pavilion-admin/order/page', {
        params: OrdersPageQueryReqDTO  // 将参数放在params对象中
    });
}

// 获取商品总数
export const getOrderCountService = () => {
    return request.get('/Treasure-Pavilion-admin/order/count');
}

// 获取今日订单数
export const getOrderTodayCountService = () => {
    return request.get('/Treasure-Pavilion-admin/order/countToday');
}




// // 删除地址
// export const deleteAddressService = (addressId) => {
//     const params = new URLSearchParams();
//     params.append('addressId', addressId);
//     return request.post('/address/deleteAddress', params);
// }

// // 修改地址
// export const updateAddressService = (address) => {
//     return request.post('/address/updateAddress', address);
// }

// 更改订单详情的收货姓名、联系电话、收货地址
// POST请求参数应该通过请求体(data)传递而非URL参数(params)。
export const updateOrderAddressService = (OrderDetailUpdateReqDTO) => {
    return request.post('/Treasure-Pavilion-admin/orderDetail/update', OrderDetailUpdateReqDTO);
}

// // 获取地址列表
// export const getAddressListService = () => {
//     return request.get('/address/getAddressList');
// }




